﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace arkanoid
{
    class Enemy
    {
        Texture2D texture;
        Vector2 position;
        public Rectangle size;
        Vector2 velocity;

        public int points = 0;

        public Enemy(Texture2D texture, Vector2 position)
        {
            this.texture = texture;
            this.position = position;
            this.velocity = new Vector2(5, 0);
            this.size = texture.Bounds;
        }

        public void Update(GameTime gameTime, Ball bola)
        {

            if (bola.size.Intersects(size))
            {
                bola.velocity.X *= -1;
                bola.velocity.Y *= -1;
            }
            //atualiza a posicao do rect da bola de acordo com  a sua posicao 
            this.size.X = (int)position.X;
            this.size.Y = (int)position.Y;

        }
        public void Draw(SpriteBatch spriteBatch , int contador)
        {
            position.X += contador;
            spriteBatch.Draw(texture, position, Color.White);
        }
    }
}
